<?php
namespace Framework\Database;

class Query {

	private $columns = '*';

	public function __construct($tableName){
		$this->tableName = $tableName;
	}

	private function db()
	{
		return app()->db;
	}

	public function tableName($tableName=null)
	{
		if( $tableName !== null ){
			$this->tableName = $tableName;
		}
		return $this->tableName;
	}

	public function column($columns){
		$this->columns = $columns;
		return $this;
	}

	public function one(){
		return $this->db()->get($this->tableName(), $this->columns, []);
	}	

	//select($table, $columns, $where)
	//select($table, $join, $columns, $where)
	public function all(){
		return $this->db()->select($this->tableName(), $this->columns, []);
	}
}